A multi-user system generally uses a locking mechanism to protect the integrity of shared data. For example, if a user wants to change one or more data sets in a shared database, the user has to request locks for these data sets before he can change the content of the data sets. The locks on the data sets can be exclusive. That is, after the user obtains the locks from the system, no other user can modify these data sets and all other lock requests for any of these data sets will be rejected by the system. Another user may obtain locks on the data sets once the user releases the locks. This conventional locking procedure is sufficient if locks are kept by a process for only short periods of time, or if there is a low likelihood of two users modifying the same data sets at the same time.
However, the conventional locking procedure can be insufficient for many business processes. For example, some processes read data from multiple data sets. Many of these data sets can potentially be, but only a few actually are, changed as a result of the processes. As another example, some processes perform data manipulation for a long time as a result of intensive computations or strong dependency on the decisions of an online user. If there are other time-critical processes running at the same time that need to modify the same data sets, the long-term locks on the data sets will result in unacceptably long downtimes for those time-critical processes.
However, if no locking mechanism is used, a process will have to determine, before saving its results, whether the underlying data sets have been modified during the runtime of the process. This determination can be difficult and time-consuming. Additionally, if the process determines that modifications have occurred during the runtime, the process may be forced to partly or completely discard its results which are rendered invalid due to the modifications. Discarding the results can be unacceptable if the results were compiled with the input of a user. Thus, there is a need for a locking mechanism that improves the drawbacks of the conventional locking procedure.